import useUserStore, { useToLogin } from "@/store/userStore";
import { Modal, Space } from "antd";
import { ExclamationCircleOutlined } from '@ant-design/icons';
const LoginHintModal = () => {
  const { loginHintInfo, actions } = useUserStore()
  const toLogin = useToLogin()

  const logout = () => {
    actions.logout()
    toLogin()
  }

  return <Modal
    centered
    open={loginHintInfo.show}
    title={loginHintInfo.title}
    cancelButtonProps={{ hidden: true }}
    okText="重新登录"
    maskClosable={false}
    onOk={logout}
    onCancel={() => actions.setLoginHint({ show: false })}
  >
    <Space size={10} align="start" style={{ padding: '10px 0' }}>
      <ExclamationCircleOutlined style={{ color: '#d89614', fontSize: '20px' }} /><span>{loginHintInfo.content}</span>
    </Space>
  </Modal>;
}

export default LoginHintModal;